import axios from 'axios';
import config from '../config'
import qs from 'qs';

let base = config.baseApiUrl;

// let base = "";
let infoBase = config.informationBaseUrl;

let pushBase = config.pushApiUrl;

let carBase = config.carApiUrl;

//登陆
export const requestLogin = params => { return axios.post(`${base}/user/login`, qs.stringify(params)).then(res => res.data); };

//获取应用id列表
export const getAppListPage = params => { return axios.get(`${base}/userBehavior/getAppConfig`, { params: params }); };

//新增应用
export const addAppConfig = params => { return axios.put(`${base}/userBehavior/addAppConfig`, qs.stringify(params)); };

//修改应用
export const updateAppConfig = params => { return axios.post(`${base}/userBehavior/updateAppConfig`, qs.stringify(params)); };

//删除应用
export const deleteAppConfig = params => { return axios.delete(`${base}/userBehavior/deleteAppConfig`, { params: params }); };

//筛选列表
export const getAppIdAndEventType = params => { return axios.get(`${base}/userBehavior/getAppListAndTypeName`, { params: params }); };

//获取事件id列表
export const getAppListEvent = params => { return axios.post(`${base}/userBehavior/getAppListEvent`, qs.stringify(params)); };

//批量新增事件id
export const addEventList = params => { return axios.put(`${base}/userBehavior/addEventList`, qs.stringify(params)); };

//删除事件id
export const deleteEvent = params => { return axios.delete(`${base}/userBehavior/deleteEvent`, { params: params }); };

//修改事件id
export const updateEvent = params => { return axios.post(`${base}/userBehavior/updateEvent`, qs.stringify(params)); };

/***************************************************/
//查看信息流列表
export const getInfoList = params => { return axios.post(`${infoBase}/message/all/list`, qs.stringify(params)); };

//撤销信息流
export const changeInfoState = params => { return axios.post(`${infoBase}/message/all/operation`, qs.stringify(params)); };

export const getTagsList = params => { return axios.get(`${base}/push/list`); };


export const addTag = params => { return axios.put(`${base}/push/add`, qs.stringify(params)); };


export const deleteTag = params => { return axios.put(`${base}/push/delete`, qs.stringify(params)); };

export const pushTag = params => { return axios.put(`${pushBase}/pushTags/tags`, qs.stringify(params)); };

export const calculateTag = params => { return axios.put(`${pushBase}/pushTags/calculate`, qs.stringify(params)); };

export const updateTag = params => { return axios.put(`${base}/push/update`, qs.stringify(params)); };


export const getBlockList = params => { return axios.post(`${base}/enter/appBlock/list`, qs.stringify(params)); };

export const updateBlock = params => { return axios.put(`${base}/enter/appBlock/update`, qs.stringify(params)); };

export const addBlock = params => { return axios.put(`${base}/enter/appBlock/insert`, qs.stringify(params)); };

export const appBlockGetVersion = params => { return axios.get(`${base}/enter/appBlock/getVersion`, qs.stringify(params)); };

export const getTabbarList = params => { return axios.post(`${base}/enter/appTabbarConfig/list`, qs.stringify(params)); };


export const getAppTabbarVersion = params => { return axios.get(`${base}/enter/appTabbarConfig/getVersion`, qs.stringify(params)); };


export const updateTabbar = params => { return axios.put(`${base}/enter/appTabbarConfig/update`, qs.stringify(params)); };

export const addTabbar = params => { return axios.put(`${base}/enter/appTabbarConfig/insert`, qs.stringify(params)); };

export const getCxyAdvertConfigList = params => { return axios.post(`${base}/enter/cxyAdvertConfig/list`, qs.stringify(params)); };

export const updateCxyAdvertConfig = params => { return axios.put(`${base}/enter/cxyAdvertConfig/update`, qs.stringify(params)); };

export const addCxyAdvertConfig = params => { return axios.put(`${base}/enter/cxyAdvertConfig/insert`, qs.stringify(params)); };


export const getAppMediaList = params => { return axios.post(`${base}/media/appMedia/list`, qs.stringify(params)); };


export const updateAppMedia = params => { return axios.put(`${base}/media/appMedia/update`, qs.stringify(params)); };


export const getEnterList = params => { return axios.post(`${base}/enter/appEnter/list`, qs.stringify(params)); };


export const updateEnter = params => { return axios.put(`${base}/enter/appEnter/update`, qs.stringify(params)); };


export const appEnterGetVersion = params => { return axios.get(`${base}/enter/appEnter/getVersion`, qs.stringify(params)); };


export const getAdList = params => { return axios.post(`${base}/ad/list`, qs.stringify(params)); };


export const getPositionList = params => { return axios.post(`${base}/ad/position/list`, qs.stringify(params)); };


export const deletePosition = params => { return axios.post(`${base}/ad/delete`, qs.stringify(params)); };


export const addAdvertOrUpdate = params => { return axios.post(`${base}/ad/addOrUpdate`, qs.stringify(params)); };


export const changeAdState = params => { return axios.post(`${base}/ad/changeAdState`, qs.stringify(params)); };


//查询（旧）品牌列表
export const getOldBrandList = params => { return axios.get(`${carBase}/fix/old/brandList`, qs.stringify(params)); };

//查询（旧）车系列表
export const getOldModelList = params => { return axios.get(`${carBase}/fix/old/modelList`, { params: params }); };

//查询品牌列表
export const getFixBrandList = params => { return axios.get(`${carBase}/fix/brandList`, { params: params }); };

//查询车系列表
export const getFixModelList = params => { return axios.get(`${carBase}/fix/modelList`, { params: params }); };

//查询车型列表
export const getFixStyleList = params => { return axios.get(`${carBase}/fix/styleList`, { params: params }); };

//保存 修复车型信息
export const saveFixStyleInfo = params => { return axios.post(`${carBase}/fix/update/model`, qs.stringify(params)); };

//查询新闻列表
export const getNewsInfo = params => { return axios.post(`${carBase}/fix/news`, qs.stringify(params)); };

//保存新闻列表
export const saveNewsInfo = params => { return axios.post(`${carBase}/fix/update/new`, qs.stringify(params)); };

//查询线索列表
export const getClusList = params => { return axios.post(`${carBase}/fix/clus`, qs.stringify(params)); };